export const deleteEmptyKey = (data: any) => {
    if (typeof data === 'object' && data) {
        Object.keys(data).forEach((key) => {
            if (typeof data[key] === 'object' && data[key]) {
                deleteEmptyKey(data[key]);
                if (JSON.stringify(data[key]) === '{}') {
                    Reflect.deleteProperty(data, key);
                }
            } else if (
                (data[key] !== 0 && data[key] !== false && !data[key]) ||
                (data[key].constructor === Array && !data[key].length)
            ) {
                Reflect.deleteProperty(data, key);
            }
        });
    }
};
